﻿<MudDrawerHeader Class="pr-2 pt-1">
    <MudText Typo="Typo.h6" Class="mt-2">@Title</MudText>
    <MudSpacer />
    <MudIconButton OnClick="CloseDrawer" Icon="@Icons.Material.Filled.Close" Color="(_IsDarkModeEnabled ? Color.Default : Color.Dark)" />
</MudDrawerHeader>
@if (DisplayDivider)
{
    <div>
        <MudDivider />
    </div>
}

@code 
{
    [CascadingParameter]
    private bool _IsDarkModeEnabled { get; set; }

    [Parameter]
    public string Title { get; set; } = string.Empty;

    [Parameter]
    public bool DisplayDivider { get; set; } = true;

    [Parameter]
    public EventCallback OnClose { get; set; }

    private void CloseDrawer() => OnClose.InvokeAsync();
}
